<!-- experiment-frontend-src-views-Student-ReportSubmission.vue -->
<template>
  <div class="report-container">
    <el-card>
      <template #header>
        <h2>实验报告提交</h2>
      </template>

      <el-form :model="reportForm" label-width="100px">
        <el-form-item label="学生姓名" required>
          <el-input v-model="reportForm.studentName" disabled />
        </el-form-item>

        <el-form-item label="班级" required>
          <el-input v-model="reportForm.class" disabled />
        </el-form-item>

        <el-form-item label="报告内容" required>
          <el-input
              v-model="reportForm.content"
              type="textarea"
              :rows="8"
              placeholder="请输入实验报告内容（建议包含实验目的、步骤、结果分析等内容）"
              resize="vertical"
          />
        </el-form-item>

        <el-form-item>
          <el-button type="primary" @click="submitReport">提交报告</el-button>
        </el-form-item>
      </el-form>
    </el-card>
  </div>
</template>

<script setup>
import { reactive } from 'vue'
import { useUserStore } from '@store/userStore.js'
import router from "@/router/index.js";

const userStore = useUserStore()

const reportForm = reactive({
  studentName: userStore.username,
  class: '计科1班', // 这里可以从用户信息获取实际班级
  content: ''
})

const submitReport = () => {
  if (!reportForm.content) {
    ElMessage.error('请填写报告内容')
    return
  }

  // 此处模拟提交逻辑
  console.log('提交报告：', reportForm)
  ElMessage.success('报告提交成功！')
  reportForm.content = ''
  router.push('/')
}
</script>

<style scoped>
.report-container {
  width: 80%;
  margin: 20px auto;
  padding: 20px;
}

.el-textarea {
  font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
}
</style>